﻿#pragma once
#include "AsGraphicsBasics.h"

__AS_JY(Update 2023.1.7)
class AS_GRAPHICS_API AsGraphics : public QGraphicsView {
	Q_OBJECT

	friend class AsGraphicsController;
	friend class AS_MEMBER_CLASS(AsGraphics);
public:
	explicit AsGraphics(QWidget* parent = nullptr);
	~AsGraphics();

private:
	bool event(QEvent* )							override;
	void showEvent(QShowEvent* )					override;
	void hideEvent(QHideEvent* )					override;
	void closeEvent(QCloseEvent*)					override;
	void resizeEvent(QResizeEvent* )				override;
	void moveEvent(QMoveEvent* )					override;
	//void paintEvent(QPaintEvent* )					override;
	void mousePressEvent(QMouseEvent* )				override;
	void mouseReleaseEvent(QMouseEvent* )			override;
	void mouseDoubleClickEvent(QMouseEvent* )		override;
	void mouseMoveEvent(QMouseEvent* )				override;
	void wheelEvent(QWheelEvent* )					override;
	void keyPressEvent(QKeyEvent* )					override;
	void keyReleaseEvent(QKeyEvent* )				override;
	//void focusInEvent(QFocusEvent* )				override;
	//void focusOutEvent(QFocusEvent* )				override;
	void dragEnterEvent(QDragEnterEvent* )			override;
	void dragMoveEvent(QDragMoveEvent* )			override;
	void dragLeaveEvent(QDragLeaveEvent* )			override;
	void dropEvent(QDropEvent* )					override;
	//void enterEvent(QEvent* )						override;
	//void leaveEvent(QEvent* )						override;
	//void changeEvent(QEvent* )						override;
	
private:
	AS_MEMBER_CLASS(AsGraphics)* m;

public:
	void addHandler(AsGraphicsObject* object);
	void removeHandler(AsGraphicsObject* object);

signals:
	void sigViewScaleChanged(double sx, double sy);
	void sigViewPositionChanged(QPointF p);

signals:
	void sigShow(QShowEvent* );
	void sigHide(QHideEvent* );
	void sigClose(QCloseEvent* );
	void sigResize(QResizeEvent* );
	void sigMove(QMoveEvent* );
	void sigPaint(QPaintEvent* );
	void sigMousePress(QMouseEvent* );
	void sigMouseRelease(QMouseEvent* );
	void sigMouseDoubleClicked(QMouseEvent* );
	void sigMouseMove(QMouseEvent* );
	void sigWheelRoll(QWheelEvent* );
	void sigKeyPress(QKeyEvent* );
	void sigKeyRelease(QKeyEvent* );
	void sigFocusIn(QFocusEvent* );
	void sigFocusOut(QFocusEvent* );
	void sigDragEnterEvent(QDragEnterEvent* );
	void sigDragMoveEvent(QDragMoveEvent* );
	void sigDragLeaveEvent(QDragLeaveEvent* );
	void sigDropEvent(QDropEvent* );
	void sigEnter(QEvent* );
	void sigLeave(QEvent* );
	void sigChange(QEvent* );
	void sigFileDragIn(QString filename);

};
